#include <stdio.h>
#include <seqlist.h>
#include <linkedlist.h>

static void print_list(int i) {
    printf("%d\n", i);
}

int main(int argc, char** argv) {
    // 顺序表测试
    vector* vec = new_vector(3);
    vec = vector_append(vec, 1);
    vec = vector_append(vec, 2);
    vec = vector_append(vec, 3);
    // 扩容
    vec = vector_append(vec, 4);
    vec = vector_append(vec, 5);
    // 遍历
    vector_for_each(vec, print_vector);
    vec = vector_insert(vec, 6, 1);
    vector_for_each(vec, print_vector);
    // 删除元素
    vector_remove(vec, 3);
    vector_for_each(vec, print_vector);
    vector_release(vec);

    // 链表测试
    linkedlist *list = new_linkedlist();
    linkedlist_append(list, 1);
    linkedlist_append(list, 2);
    linkedlist_insert(list, 3, 1);
    linkedlist_for_each(list, print_vector);
    linkedlist_remove(list, 1);
    linkedlist_for_each(list, print_vector);
    linkedlist_release(list);
    list = NULL
}